<?php
/**
 * User: @lose
 * Date: 2019-10-24
 * Time: 11:11
 */

namespace Biz\module\Classes\adm;

use Doraemon\model\Photos;

class PhotoTagSearch
{
    public $tag_status = null; // 标签状态
    public $score = []; // 分数
    public $photo_num = null; // 图片数量
    public $relate_goods = []; // 关联商品
    public $search_photo_type = null; // 搜索图片类型
    public $release_time = []; // 发图时间
    public $search_type = null; // 搜索方式
    public $search_tag = null; // 搜索标签
    public $photo_id = null; // 图片ID
    public $uid = null; // 用户ID
    public $onlyNoteHasSpaceTag=null;//note中有空间标签且pic中无空间标签
    public $filter_source_type=[Photos::SYSTEM_IMG, Photos::TYPE_LIVE, Photos::TYPE_TOTEM];//过滤note类型
    public $filter_show_status=[Photos::SHOW_STATUS_SHARE_VISIBLE];//过滤展示状态
    public $page = 1;
    public $page_size = 20;

    public function __construct($params)
    {
        if(isset($params['tag_status']) && $params['tag_status']) {
            $this->tag_status = $params['tag_status'];
        }

        if(isset($params['score']) && $params['score']) {
            $this->score = $params['score'];
        }

        if(isset($params['photo_num']) && $params['photo_num']) {
            $this->photo_num = $params['photo_num'];
        }

        if(isset($params['relate_goods']) && $params['relate_goods']) {
            $this->relate_goods = $params['relate_goods'];
        }

        if(isset($params['only_note_has_space_tag']) && $params['only_note_has_space_tag']) {
            $this->onlyNoteHasSpaceTag = $params['only_note_has_space_tag'];
        }

        if(isset($params['search_photo_type']) && $params['search_photo_type']) {
            $this->search_photo_type = $params['search_photo_type'];
        }

        if(isset($params['release_time']['start']) && $params['release_time']['start']) {
            $this->release_time['start'] = $params['release_time']['start'];
        }

        if(isset($params['release_time']['end']) && $params['release_time']['end']) {
            $this->release_time['end'] = $params['release_time']['end'];
        }

        if(isset($params['search_type']) && $params['search_type']) {
            $this->search_type = $params['search_type'];
        }

        if(isset($params['search_tag']) && $params['search_tag']) {
            $this->search_tag = $params['search_tag'];
        }

        if(isset($params['photo_id']) && $params['photo_id']) {
            $this->photo_id = $params['photo_id'];
        }

        if(isset($params['uid']) && $params['uid']) {
            $this->uid = $params['uid'];
        }

        if(isset($params['page'])) {
            $this->page = abs($params['page']) ? abs($params['page']) : $this->page;
        }

        if(isset($params['per_page'])) {
            $this->page_size = $params['per_page'];
        }

        if(isset($params['filter_source_type']) && $params['filter_source_type']) {
            $this->filter_source_type = (array) $params['filter_source_type'];
        }
    }
}